import React, { useState } from 'react'
import ClickCounter2 from './ClickCounter2'

export default function ClickContainer2() {

  let [showChild,setShowChild] = useState(true)

  return (
    <div style={{margin:'20px',
      padding:'10px',
      backgroundColor:'#fcf'}}>
      <h3>ClickContainer2 - 父组件</h3>
      <button onClick={()=>{setShowChild(!showChild)}}>
        显示/隐藏子组件
      </button>
      {showChild && <ClickCounter2/>}
    </div>
  )
}
